<!-- 
    Copyright (C)  2011  chen wei hua.
    Permission is granted to copy, distribute and/or modify this document
    under the terms of the GNU Free Documentation License, Version 2.0
    or any later version published by the Free Software Foundation;
    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
    A copy of the license is included in the section entitled "GNU Free Documentation License".
 -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../../../common/jsp/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>结算管理-存货台帐</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<%@ include file="../../../common/jsp/config.jsp"%>
<script type="text/javascript" src="common/js/calendar/WdatePicker.js" ></script>
<script type="text/javascript">
    function querySubmit() {
    	$("#queryMaterialsMonthChangeDetail").submit();
    	return false;
    }

    function skuChange(id) {
    	$("#skuDetailId").val(id);
    	querySubmit();
    }
    
    function openSelectDialog() {
     	alertDialog(700, 500, "showSelectMaterialsDialog.action", 
     	function (result) {
     		var materials = result.materials;
     		if (materials) {
     			$("#materialsId").val(materials.id);
     			$("#skuDetailId").val(result.skuId);
         		var str = '<td>' + materials.rootCategory.name + '</td>';
         		str += '<td>' + materials.category.name + '</td>';
         		str += '<td>' + materials.name + '</td>';
         		str += '<td>' + materials.type + '</td>';
         		str += '<td>' + materials.units + '</td>';
         		$("#materialsInfoTable").find("tr:last").empty().append(str);
     		}
     	});
    }
    
  	$(document).ready(function() {
		
	});
</script>
</HEAD>
<BODY>
    <div class="subnav" align="left">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="100%" align="left" height="31">&nbsp;<img src="common/images/title-pk.gif" border="0"  align="absmiddle"/>&nbsp;<span class="subnavtxt1">结算管理</span>
			&nbsp;<img src="common/images/leftico2.gif" border="0"  align="absmiddle"/>&nbsp;<span class="subnavtxt2">存货台帐</span></td>
		  </tr>
		</table>
    </div>
   <div class="divborder">
      <s:form action="queryMaterialsMonthChangeDetail">
        <table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr>
            <td width="10%" align="right">月份</td>
            <td width="25%">
				<s:textfield name="queryDate" onclick="WdatePicker({dateFmt:'yyyy-MM'})" readonly="true" size="10" />
			</td>
            <td width="25%">
                <s:radio list='#{"0":"合格库存", "1":"不合格库存"}' name="queryType" />
			</td>
            <td width="10%" align="right">在库品</td>
            <td width="25%">
			    <input type="button" value="请选择" onclick="openSelectDialog()" />
			    <s:hidden id="materialsId" name="materialsId" />
			    <s:hidden id="skuDetailId" name="skuDetailId" />
			</td>
            <td align="left"><input name="button" type="button" class="input1" value="查 询" onclick="querySubmit()"/></td>
          </tr>
          <tr>
            <td colspan="5">
			  <div class="ksglxx2">
			    <table id="materialsInfoTable" width="500px" cellpadding="0" cellspacing="1" border="0" class="ksglxx2a">
			        <tr class="ksglxx2bg">
			          <th width="50px" >大分类</th>
			          <th width="60px" >中分类</th>
			          <th width="95px" >名称</th>
			          <th width="180px" >型号</th>
					  <th width="50px">单位</th>
					</tr>
			        <tr class="odd">
			          <td><s:property value="materials.rootCategory.name" /></td>
			          <td><s:property value="materials.category.name" /></td>
			          <td><s:property value="materials.name" /></td>
			          <td><s:property value="materials.type" /></td>
			          <td><s:property value="materials.units" /></td>
					</tr>
            	</table>
			  </div>
            </td>
          </tr>
        </table>
      </s:form>
    </div>
    <div class="clean" style="height:20px"></div>
	<div id="tb_" class="tb_">
	  <ul>
	    <s:iterator value="materials.skuDetails" id="detail" status="st">
	      <s:if test="#detail.id==skuDetailId">
	        <li class="hovertab" onClick="" ><s:property value="#detail.customFieldCombox" /></li>
	      </s:if>
	      <s:else>
	      	<li class="normaltab" onClick='skuChange(<s:property value="#detail.id" />)' ><s:property value="#detail.customFieldCombox" /></li>
	      </s:else>
	    </s:iterator>
	  </ul>
    </div>
	<div class="dis" id="tbc_01">
     <div class="main_scroll_long">
      <table width="900px" cellpadding="0" cellspacing="1" border="0" class="ksglxx2a">
        <tr class="ksglxx2bg">
          <th width="95px" >记账日期</th>
          <th width="120px" >单号</th>
          <th width="180px" >摘要</th>
          <th width="120px" >批次</th>
          <th width="95px" >入库数</th>
          <th width="95px" >出库数</th>
          <th width="95px" >结存</th>
		  <th width="50px">单价</th>
		  <th width="95px">金额</th>
		</tr>
		<s:iterator value="changeDetails" id="detail" status="st">
          <s:if test="#st.Odd">
            <tr class="odd">
          </s:if>
          <s:else>
            <tr class="even">
          </s:else>
	          <td><s:date name="#detail.date" format="yyyy-MM-dd"/></td>
	          <td><s:property value="#detail.voucherNo" /></td>
	          <td><s:property value="#detail.name" /></td>
	          <td><s:property value="#detail.batchNo" /></td>
	          <td><s:property value='%{#detail.inNumber==0?"":#detail.inNumber}' /></td>
	          <td><s:property value='%{#detail.outNumber==0?"":#detail.outNumber}' /></td>
	          <td><s:property value="#detail.number" /></td>
	          <td><s:property value='%{#detail.price==0?"":#detail.price}' /></td>
	          <td><s:property value="#detail.amount" /></td>
          </tr>
		</s:iterator>
       </table>
      </div>
     </div>
</BODY></HTML>
